package com.competition.controller;

import com.competition.dao.FarmerDao;
import com.competition.entity.Farmer;
import com.competition.mapper.FarmerMapper;
import com.competition.mapper.UserMapper;
import com.competition.resp.ResponseResult;
import com.competition.service.FarmerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/farmer")
public class FarmerController {
    @Autowired
    private FarmerMapper farmerMapper;
    @Autowired
    private FarmerService farmerService;



    @GetMapping("/getFarmer")
    public ResponseResult getFarmer(){
        try {
            List<FarmerDao> allByFarmer = farmerMapper.getAllByFarmer();
            return new ResponseResult(200,"获取成功",allByFarmer);
        } catch (Exception e) {
            e.printStackTrace();
            return new ResponseResult(400,"获取失败",null);
        }
    }
}
